#include <iostream>
#include <vector>
using namespace std;

struct TreeNode {
  int val;
  TreeNode *left;
  TreeNode *right;
  TreeNode() : val(0), left(nullptr), right(nullptr) {}
  TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
  TreeNode(int x, TreeNode *left, TreeNode *right)
      : val(x), left(left), right(right) {}
};

class Solution {
public:
  vector<int> inorderTraversal(TreeNode *root) {
    vector<int> v;
    inOrder(root, v);
    return v;
  }

  void inOrder(TreeNode *t, vector<int> &v) {
    if (t == nullptr) {
      return;
    }
    inOrder(t->left, v);
    v.push_back(t->val);
    inOrder(t->right, v);
  }
};